package net.csdn.business.common.domain.common;

import lombok.Data;
import net.csdn.business.common.enums.AuditEnum;
import net.csdn.business.common.enums.IssueEnum;
import net.csdn.business.common.utils.HtmlParserTextUtil;

import java.io.Serializable;

/**
 * @author likun
 * @date 2022/7/18 15:48
 */
@Data
public class IssueSearchDto implements Serializable {
    private String uid;

    private String keyword;

    private Integer status;

    private String order = IssueEnum.OrderByEnum.RECENTLY_UPDATE.getCode() + " desc";
    /**
     * 审核状态
     */
    private Integer auditStatus;


    public IssueSearchDto(String keyword, IssueEnum.StatusEnum status, IssueEnum.OrderByEnum order, AuditEnum.AuditStatusEnum adAuditStatusEnum) {
        this.keyword = HtmlParserTextUtil.clearHtml(keyword);
        if (null != status) {
            this.status = status.getCode();
        }
        if (null != order) {
            this.order = order.getField() + " " + (order.getOrder() ? "asc" : "desc");
        }
        this.auditStatus = adAuditStatusEnum.getCode();
    }
}